<template>
	<div id="endorse">
		<div class="rules">
			<p class="tit">{{title}}</p>
			<ul v-if="isInland">
				<li class="flex" v-for="item in text">
					<p class="title"><span class="bg">{{item.title}}</span></p>
					<p>{{item.content}}</p>
				</li>
			</ul>
		</div>
	</div>
</template>
<script>
	import { mapState, mapMutations } from 'vuex'
	export default {
		name: 'help',
		data() {
			return {
				title: "以下退改签规则仅供参考，请以航空公司官网为准！",
				text: [],
			};
		},
		computed:{
			...mapState([
				'city', 'Date', 'cabin', 'isBack', 'adultCount', 'flight', 'isInland','interRT','token',
			]),
		},
		methods:{
			getRules(){
				this.$axios({
					method: 'post',
					url: 'refundEndorse/rule',
					data:this.getData(),
					headers: {'authorization':this.token}
				})
				.then((res) => {
					if(res.data.status==1001){
						this.text = [
							{'title':'退票规定','content':res.data.data.endorsementRule[0].refundRule},
							{'title':'签转规定','content':res.data.data.endorsementRule[0].endorseRule},
							{'title':'更改规定','content':res.data.data.endorsementRule[0].changeRule},
							{'title':'备注','content':res.data.data.endorsementRule[0].remark}
						];
					}
				})							
			},
			getData(){
				//来自订单详情的请求
				var data = this.$route.query.data;
				if(data) return JSON.parse(data);
				//非订单详情的请求
				var cabinCode = this.$route.query.cabinCode;
				var result = {};
				var length = this.flight.inland.length;
				result.airCompany = (this.flight.inland[length-1].segments[0].flightNo).substr(0,2);
				result.fromAirport = this.flight.inland[length-1].segments[0].fromAirport;
				result.toAirport = this.flight.inland[length-1].segments[0].toAirport;
				result.cabinInfo = cabinCode;
				result.fromDate = (this.flight.inland[length-1].segments[0].fromDate).substr(0,10);
				result.lastUpdateTime = null;
				result.pageNo = 1;
				result.countPerPage = 10;				
				return result;
			},
			getData_Order(){
				var result = {};
				return result;
			}
		},
		created() {
			
			document.title = "退改签说明"
			if(this.isInland) this.getRules();					
		}
	};
</script>
<style lang="scss">
	@import '../../style/mixin.scss';
	#endorse {
		min-height:100vh;
		padding: 5px 4% 5px;
		background:$lightGray;
		.rules{
			background:$white;
			border-radius:5px;
			padding:3%;
			.tit{
				text-align:center;
			}
			li{
				@include border_1px_b($shadow);
				padding:15px 0;
				.title{
					min-width:70px;
					.bg{
						background:$blue;
						color:$white;
						border-radius:2px;
						padding:2px;
					}
				}
			}
			li:last-child:after{
				border:none;
			}
		}
	}
</style>